import { ResponseType } from "../type/response"
import { UserInfo } from "../type/userTypes"
import request from "../utils/request"
enum Enum {
  loginAPI = "/weixin/wxLogin",
  fetchUserInfoAPI = "/weixin/getuserInfo",
  updateUserInfoAPI = "/weixin/updateUser"
}
/**
 * @description 微信登录的接口
 */
export const loginAPI = (code: string) => request.get<ResponseType<{ token: string }>>(`${Enum.loginAPI}/${code}`)

/**
 * @description 获取用户信息的接口
 */
export const fetchUserInfoAPI = () => request.get<ResponseType<UserInfo>>(Enum.fetchUserInfoAPI)

/**
 * @description 更新用户信息的接口
 */
export const updateUserInfoAPI = (userInfo: UserInfo) => request.post(Enum.updateUserInfoAPI, userInfo)